#include"DList.h"

void LTPushBack(LTNode* phead, DLTDataType x)
{
	assert(phead);
	LTNode* newnode = BuyNewListNode(x);
	LTNode* tail = phead->prev;
	phead->prev = newnode;
	newnode->next = phead;
	newnode->prev = tail;
	tail->next = newnode;
}

LTNode* BuyNewListNode(DLTDataType x)
{
	LTNode* newnode = (LTNode*)malloc(sizeof(LTNode));
	if (newnode == NULL)
	{
		perror("BuyNewListNode->malloc");
		exit(-1);
	}
	newnode->data = x;
	newnode->next = NULL;
	newnode->prev = NULL;
}

